/**
 * 
 * 广州锐鹏计算机科技有限公司（www.ruipengkj.com）
 * 
 * 
 * Copyright (c) 2011-2012 RUIPENGKJ.Co.Ltd. All rights reserved.
 * 
 * */
package com.ruipengkj.component.jtable;

import java.awt.Color;
import java.awt.Component;
import java.awt.Graphics;

import javax.swing.JLabel;
import javax.swing.JTable;
import javax.swing.table.DefaultTableCellRenderer;
/**
 * 说明：
 * 下单面板 渲染器 
 */
public class JLabelColorTableCellRenderer extends DefaultTableCellRenderer {
															
	private static final long serialVersionUID = 1L;
	
	private Color fgColor;
//	private ImageIcon icon=ImageFactory.loadImage(ImageFactory.TABLE_ORDER_LINE);
	
	public JLabelColorTableCellRenderer(Color fgColor){
		this.fgColor = fgColor;
	}
	
	@Override
	public Component getTableCellRendererComponent(JTable table, Object value,
			boolean isSelected, boolean hasFocus, int row, int column) {
		JLabel label = new JLabel(value.toString(), null, JLabel.CENTER){
			private static final long serialVersionUID = 1L;
			@Override
			protected void paintBorder(Graphics g) {
//				super.paintBorder(g);
				g.setColor(new Color(175, 173, 173));
				int x = 0;
				int y = this.getHeight()-1;
				while(x <= this.getWidth()-1) {
					g.drawLine(x, y, x, y);
					x += 2;
				}
			}
		};
		label.setForeground(fgColor);
		return label;
	}
}
